Skip to content

Wire up notification style preference#15

Merged
JanJetze merged 1 commit intomasterfrom
feat/wire-up-notification-style
Mar 8, 2026
Merged

Wire up notification style preference#15
JanJetze merged 1 commit intomasterfrom
feat/wire-up-notification-style

Conversation

@JanJetze
Copy link
Copy Markdown
Owner

@JanJetze JanJetze commented Mar 8, 2026

Summary

  • The notification style setting (Minimal/Detailed) existed in the Settings UI and DataStore but the foreground service hardcoded MINIMAL. Now the service reads the stored preference and reacts to changes instantly.
  • Added NotificationStyle.fromPreference() to convert DataStore strings to the enum, with fallback to MINIMAL for unknown values.
  • Added a launchNotificationStyleObserver() coroutine that collects the preference Flow and immediately updates the notification when the user changes the style — no more waiting up to 30 seconds.
  • Removed dead NotificationHelper.updateNotification() method (replaced by startForeground() calls for more reliable notification updates).

Test plan

  • Unit tests pass (fromPreference conversion, case-insensitivity, unknown fallback)
  • Set notification style to "Detailed" → notification shows steps, distance, and activity
  • Set notification style to "Minimal" → notification shows only step count
  • Style change takes effect immediately (no 30s delay)
  • Preference persists across app restarts

Closes #14

…antly

The notification style setting (Minimal/Detailed) existed in the UI and
DataStore but the service hardcoded MINIMAL. Now the service reads the
preference on startup and observes it as a Flow so changes apply
immediately without waiting for the 30-second ticker.

- Add NotificationStyle.fromPreference() to convert DataStore strings
- Read preference in startForegroundWithNotification() and ticker
- Add launchNotificationStyleObserver() for instant style switching
- Use startForeground() for updates (more reliable than notify())
- Remove unused NotificationHelper.updateNotification() and its field
- Add unit tests for fromPreference()

Closes #14

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JanJetze JanJetze merged commit 5e5640e into master Mar 8, 2026
1 check passed
@JanJetze JanJetze deleted the feat/wire-up-notification-style branch March 8, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve notification: allow disabling and add more detail options

1 participant